package com.heima.admin.controller;

import com.heima.admin.dto.LoginDto;
import com.heima.admin.service.IAdUserService;
import com.heima.common.dto.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 管理员用户信息表 前端控制器
 * </p>
 *
 * @author GQ
 * @since 2022-07-27
 */
@RestController
@RequestMapping("/login")
@Api(tags = "管理员用户信息表接口")
//@CrossOrigin
public class AdminController{

    @Autowired
    private IAdUserService adUserService;

    /**
     * 管理员登录
     * @param loginDto 登录信息
     * @return 业务数s据：data:{user:{},token:""}
     */
    @PostMapping("/in")
    @ApiOperation(value = "管理员登录", notes = "author:gq")  // value指名称  notes 备注
    @ApiImplicitParam(name = "dto", value = "登录对象", required = true, dataType = "loginDto")
    public ResponseResult login(@RequestBody LoginDto loginDto){
        return adUserService.login(loginDto);
    }

}
